<?php if (!defined('BASEPATH')) {
	exit('No direct script access allowed');
}

class Consumption_model extends CI_Model {
	public function __construct() {
		parent::__construct();
	}

	public function get_zones(){
	 $sql = "SELECT * FROM app_lookup_values WHERE lookup_type = 'LUMBIA_AREAS' ";

	 $query = $this->db->query($sql);
	 return $query->result();
	}

	public function get_cons($mon,$yr,$zone){
		$sql= "SELECT umr.* , aa.acct_name, aa.acct_num FROM ubs_meter_readings umr
		INNER JOIN ar_account aa on aa.account_id = umr.account_id
		INNER JOIN ar_entity_address aea ON aea.address_id = aa.acct_addr
        WHERE umr.bill_month = ".$mon." AND umr.bill_year = ".$yr." AND aea.zone_1 = '".$zone."'
        ";

        $query = $this->db->query($sql);
	 	return $query->result();
	}

	public function getzoning($zone) {
		$this->db->where('zone_code', $zone);
		$query = $this->db->get('ar_zones');
		return $query->result();
	}

	public function getzoning2($zone) {
		$this->db->where('zone_code', $zone);
		$query = $this->db->get('ar_zone_values');
		return $query->result();
	}
}